
#include "iostream"
#include "vector"
#include "unordered_map"
#include "unordered_set"
#include "algorithm"
#include "string"
#include "list"
#include "string.h"
#include "math.h"

int chunsu_table[] =
        {2,3,5,7,23,29,31,37,53,59,71,73,79,233,239,293,311,313,317,373,379,593,599,719,733,739,797,2333,2339,2393,2399,2939,3119,3137,3733,3739,3793,3797,5939,7193,7331,7333,7393,23333,23339,23399,23993,29399,31193,31379,37337,37339,37397,59393,59399,71933,73331,73939,233993,239933,293999,373379,373393,593933,593993,719333,739391,739393,739397,739399,2339933,2399333,2939999,3733799,5939333,7393913,7393931,7393933,23399339,29399999,37337999,59393339,73939133};

//std::unordered_map<int,char> map;
char map_arr[100000000]={0};
bool is_su(int n){
    if(n==1){
        return false;
    }
    if(map_arr[n]>0){
        return map_arr[n]==1;
    }
//    if(map.find(n)!=map.end()){
//        return map[n]==1;
//    }
    if(n==2){
        map_arr[n]=1;
        return true;

    }
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            map_arr[n]=2;
            return false;
        }
    }
    map_arr[n]=1;
//    map[n]=1;
    return true;
}



bool is_chun_cu(int n){
    while(n){
        if(!is_su(n)){
            return false;
        }
        n/=10;
    }
    return true;
}

class OneLoop {
public:

    void print_T_su(int T) {
        int begin = 1;
        for (int i = 1; i < T; i++) {
            begin *= 10;
        }
        int end = begin * 10;
        for (int i = 0; i < sizeof(chunsu_table)/4; i++) {
//            if (chunsu_table[i] < 0) {
//                break;
//            }
            if (chunsu_table[i] >= begin && chunsu_table[i] < end) {
                printf("%d\n", chunsu_table[i]);
            }
        }
//        for()
    }

    OneLoop(int a) {
        for (int i = 0; i < a; i++) {
            int n;
            std::cin >> n;
            print_T_su(n);
        }
    }
};

class Solution {
public:
    void run() {

        bool first = true;
        int a, b;
        std::string s;
        while (
                std::cin >> a
//                std::getline(std::cin,s)\

                ) {
            OneLoop loop(a);
        }
    }
};


int main() {


//    for(int i=3;i<100000000;i++){
//        if(is_chun_cu(i)){
//            printf("%d,",i);
//        }
//    }

//    bool cur_num= true;
    Solution().run();
    return 0;
}

